package com.kalaqia.image.glide;

import android.support.annotation.NonNull;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.data.DataFetcher;

/**
 * @author kalaqia 421407393@qq.com
 */
public class ImageDataFetcher implements DataFetcher<String> {

    private String url;

    public ImageDataFetcher(@NonNull String url) {
        this.url = url;
    }

    @Override
    public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super String> callback) {
        String result = String.format("http://zhibo.zfxfu.com/", url);
        callback.onDataReady(result);
    }

    @Override
    public void cleanup() {

    }

    @Override
    public void cancel() {

    }

    @NonNull
    @Override
    public Class<String> getDataClass() {
        return String.class;
    }

    @NonNull
    @Override
    public DataSource getDataSource() {
        return DataSource.LOCAL;
    }
}
